home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
batchut
/
beeper1.zip
/
BEEP45.ASM
< prev
next >
Wrap
Assembly Source File
|
1991-06-05
|
2KB
|
85 lines
; BEEP45.COM by Duane Paulson 06/05/91.
; Beeps once a second for approx. 45 seconds or until a key is pressed.
; Created using comtemp.asm template by Chuck Nelson; (c) NELSOFT Software.
; All rights reserved. Used by permission.
; Comtemp.asm is included in The PC Assembler Helper and Tutor by
; Chuck Nelson, downloadable as "PCTUTOR.xxx".
COMSEG SEGMENT PUBLIC 'CODE'
ASSUME cs:COMSEG, ds:COMSEG, es:COMSEG, ss:COMSEG
ORG 100h
main proc NEAR
start: mov ax,0E07h ; TTY output - ascii 7 (beep)
mov bh,0 ; primary video page
int 10h ; call bios
main_loop:
mov ah,0 ; get system timer
int 01Ah ; call bios
; system timer returns a double word (32 bits).
; since we're only waiting for one second,
; looking at the low word will suffice.
add dx,18 ; add 18 to low word (timer ticks 18 times/sec)
mov low_timer,dx ; store low word
wayt: mov ah,0Bh ; check for character waiting
int 21h ; call dos
cmp al,0FFh ; character waiting?
je clear_buffer ; then exit
mov ah,0 ; get system timer
int 01Ah ; call bios
cmp dx,low_timer ; compare low word to low_timer
jb wayt ; loop for 1 second
mov ax,0E07h ; TTY output - ascii 7 (beep)
mov bh,0 ; primary video page
mov cx,1 ; display 1 character
int 10h ; call bios
inc count ; check if 45 seconds has passed
cmp count,40
jne @F
jmp short endit
@@: mov ah,0Bh ; check for character waiting
int 21h ; call dos
cmp al,0 ; no keypress?
je main_loop ; then loop
clear_buffer:
mov ah,7 ; Character input without echo
int 21h ; call dos
endit: mov ah,0Bh ; check for character waiting
int 21h ; call dos
cmp al,0FFh ; character waiting?
je clear_buffer ; then loop
mov ax,4C00h ; exit with 0 exit code
int 21h ; call dos and exit
ret
main endp
low_timer dw ?
count db 0
COMSEG ENDS
END start